//
//  NetWorkManager.h
//  DailyRecord
//
//  Created by Gin on 2022/3/27.
//

#import <Foundation/Foundation.h>

typedef NS_ENUM(NSInteger, NetWorkManagerrequestSerializerType) {
    NetWorkManagerrequestSerializerTypeForm,
    NetWorkManagerrequestSerializerTypeJson
};


typedef void(^RequestSuccessBlock) (NSURLSessionDataTask * _Nonnull task, id _Nullable responseObj);

typedef void(^RequestFailBlock) (NSURLSessionDataTask * _Nonnull task, NSError * _Nullable error);

NS_ASSUME_NONNULL_BEGIN

@interface NetWorkManager : NSObject

+ (void)getWithURLString:(NSString *)URLString
              parameters:(id)parameters
                 headers:(NSDictionary *)headers
                 success:(RequestSuccessBlock)success
                 failure:(RequestFailBlock)failure;

+ (void)postWithURLString:(NSString *)URLString
   requestSerializerType:(NetWorkManagerrequestSerializerType)requestSerializerType
              parameters:(id)parameters
                 headers:(NSDictionary *)headers
                 success:(RequestSuccessBlock)success
                  failure:(RequestFailBlock)failure ;

+ (void)postWithURLString:(NSString *)URLString
               parameters:(id)parameters
                  headers:(NSDictionary *)headers
                  success:(RequestSuccessBlock)success
                  failure:(RequestFailBlock)failure;
@end

NS_ASSUME_NONNULL_END
